@extends('layouts.master')
@section('head')
	@parent
	<title>FACT - Events</title>

	<script type="text/javascript">
		function printDiv(divId){
			var restorepage = document.body.innerHTML;
			var printcontent = document.getElementById(divId).innerHTML;
			document.body.innerHTML = printcontent;
			window.print();
			document.body.innerHTML = restorepage;
		}
	</script>

	<script type="text/javascript" src="/js/jquery.fancybox.js"></script>
	<link rel="stylesheet" type="text/css" href="/css/jquery.fancybox.css" media="screen" />
   	<script type="text/javascript">
		$(document).ready(function() {
			$('.fancybox').fancybox();
		});
	</script>
@stop

@section('content')
	<div class="main">
		<div class="shop_top">
			<div class="container" style="margin-top: -30px;">
			<!-- if admin, show create link -->
			@if(Auth::user()->first_name == 'Admin')
				<div>			
					<div class="col-md-1">
						<button class="btn btn-primary"><a href="/events/create" style="color:white;">Create New Event</a></button>
					</div>
					<div class="col-md-1" style="margin-left: 60px;">
						<button class="btn btn-primary"><a href="/events/create" style="color:white;">To Archive</a></button>
					</div>

					{!! Form::open(array('method'=>'delete', 'route'=>['events.destroy', $event->id])) !!}
						<div class="col-md-1" style="margin-left: 13px;">
							<button class="btn btn-primary"><a style="color:white;">Delete Event</a></button>
						</div>
					{!! Form::close() !!}			
					<div class="col-md-1" style="margin-left: 28px;">
						<button class="btn btn-primary" onclick="printDiv('divPrint')"><a style="color:white;">Print Event</a></button>
					</div>
				</div>
			@endif

			<div class="col-md-12 ev-mar">
				<h3 class="m_6 col-md-3" style="margin-left: -17px;"><a href="/events">Events</a></h3>
			</div>
		
				<div id="divPrint" class="shop_top mb1">
					<div class="col-md-6">
						<h4 class="title">{{ $event->title }}</h4>
						<h5 class="title">Date: {{ date("F d, Y l", strtotime($event->date)) }}</h5>
						<h5 class="title">Time: {{ $event->time }}</h5>
						<p class="event1">{{ $event->description }}</p>
					</div>
					<div class="col-md-6">
						<div class="img_section magnifier2 photo-border" style="margin-top: 60px;">
							<a class="fancybox" href="/images/{{$event->image}}" data-fancybox-group="gallery"><img src="/images/{{$event->image}}" class="img-responsive" alt=""><span> </span>					
							</a>
						</div>	
					</div>				
				</div>
			</div>
		</div>
	</div>
@stop